package com.yi.servicemap.service;

import com.yi.internalcommon.dto.ResponseResult;
import com.yi.internalcommon.responese.DirectionResponse;
import com.yi.servicemap.remote.MapDirectionClient;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

@Service
public class DirectionService {
    @Autowired
    private MapDirectionClient mapDirectionClient;
    /**
     * 根据七点经纬度和终点经纬度获取距离（米）和时长（分钟）
     *
     * @param depLongitude
     * @param depLatitude
     * @param destLongitude
     * @param destLatitude
     * @return
     */
    public ResponseResult driving(String depLongitude, String depLatitude, String destLongitude, String destLatitude) {
        //调用地图接口(高德)
        DirectionResponse direction = mapDirectionClient.direction(depLongitude, depLatitude, destLongitude, destLatitude);
        return ResponseResult.success(direction);
    }
}
